package org.whl.airapi.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.whl.airapi.dto.Hum;
import org.whl.airapi.service.HumService;
import org.whl.airapi.util.list.ListToChart;
import java.util.List;
/**
 * @author 王浩霖
 * @version 1.0.0 2024/12/26 10:12
 */
@RestController
@RequestMapping("/Air")
@RequiredArgsConstructor
public class HumController {
    private final HumService airPollutionService;

    @GetMapping("/Hum")
    public List<List<Object>> airPollutionZhuxingtu() throws IllegalAccessException {
        List<Hum> airpo = airPollutionService.list();
        // 使用 ListToChart 工具类生成柱状图和折线图的数据
        List<List<Object>> chartData = ListToChart.baseLine(airpo, Hum.class);

        // 返回结果
        return chartData;

    }


}
